Trò chơi game bắn súng đơn giản trong UNITY Engine
23.629 lượt xem;
1 using UnityEngine;
2 using System.Collections;
3
4 public class Borders : MonoBehaviour
5 {
6 Transform c_motorPos;
7
8 void Awake ()
9 {
10 c_motorPos = GameObject.FindObjectOfType<CameraMotor>().GetComponent<Transform>();
11 }
12
13 void Update ()
14 {
15 Vector3 tempPos = new Vector3(transform.position.x, transform.position.y, c_motorPos.position.z);
16 transform.position = tempPos;
17 }
18 }
2 using System.Collections;
3
4 public class Borders : MonoBehaviour
5 {
6 Transform c_motorPos;
7
8 void Awake ()
9 {
10 c_motorPos = GameObject.FindObjectOfType<CameraMotor>().GetComponent<Transform>();
11 }
12
13 void Update ()
14 {
15 Vector3 tempPos = new Vector3(transform.position.x, transform.position.y, c_motorPos.position.z);
16 transform.position = tempPos;
17 }
18 }